Fix warning regarding possible buffer overrun#17513
Merged
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom Apr 20, 2020
Merged
Fix warning regarding possible buffer overrun#17513thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
Conversation
Contributor
|
Good on the F1, removes the warning, was introduced by #17459 |
Member
|
I wonder if it would be beneficial to apply the same format specifier elsewhere… |
Contributor
Author
Fortunately newer versions of gcc are a lot better about warning you when they will cause issues. At least on intel architectures you could have bad behaviors if the format specifier and argument mismatched, because if arguments had to be passed on the stack it would pop the wrong number of bytes from the stack at the end of the call. |
jmp0x0000
pushed a commit
to jmp0x0000/Marlin
that referenced
this pull request
Aug 7, 2020
njibhu
pushed a commit
to njibhu/Marlin
that referenced
this pull request
Aug 24, 2020
HairingX
pushed a commit
to HairingX/Marlin
that referenced
this pull request
Jun 16, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix a warning indicating the sprintf command could overrun the destination buffer.
'%i' directive writing between 1 and 6 bytes into a region of size between 5 and 10 [-Wformat-overflow=]The solution was two-fold:
tempan int16_t to reduce the maximum printed length (this matches the source data size)Related Issues
#17506